Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): prevent null outputContent #1134

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

dbyron-sf
Copy link
Contributor

@dbyron-sf dbyron-sf commented Jan 23, 2025

in the BakeStatus that JobExecutorLocal.updateStatus returns.

Before this change, if the output of e.g. helm template is an empty string, the BakeStatus object that JobExecutorLocal.updateStatus returns is null, and HelmTemplateUtils.removeTestsDirectoryTemplates throws a NullPointerException.

HelmBakeManifestService.bake calls BakeManifestService.doBake which calls JobExecutorLocal.updateStatus, and then HelmBakeManifestService.bake calls HelmTemplateUtils.removeTestsDirectoryTemplates with the resulting String.

With this change, removeTestsDirectoryTemplates gets an empty string, and so the bake manifest endpoint (e.g. POST /api/v2/manifest/bake/helm) returns an empty Artifact.

Note that there's no Bake Manifest YAML link in bake manifest stages with empty bakes, but this still feels like progress.

As well, without a corresponding change to clouddriver (spinnaker/clouddriver#6337) to handle a null KubernetesManifest, there's still a clouddriver crash in a deploy manifest that consumes the output of this bake, but again, progress.

FWIW this is effectively a followup to #362. That PR added outputContent and there's still only the one place in the code that uses it. So, there aren't other behavior changes to consider.

…ty output

This test currently fails.  The next commit fixes it.
in the BakeStatus that JobExecutorLocal.updateStatus returns.

Before this change, if the output of e.g. helm template is an empty string, the BakeStatus object that JobExecutorLocal.updateStatus returns is null, and HelmTemplateUtils.removeTestsDirectoryTemplates throws a NullPointerException.

HelmBakeManifestService.bake calls BakeManifestService.doBake which calls JobExecutorLocal.updateStatus, and then HelmBakeManifestService.bake calls HelmTemplateUtils.removeTestsDirectoryTemplates with the resulting String.

With this change, removeTestsDirectoryTemplates gets an empty string, and so the bake manifest endpoint (e.g. POST /api/v2/manifest/bake/helm) returns an empty Artifact.

Without a corresponding change to clouddriver to handle a null KubernetesManifest, there's still a clouddriver crash in a deploy manifest that consumes the output of this bake, but it's progress.
@dbyron-sf dbyron-sf marked this pull request as ready for review January 23, 2025 03:19
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Jan 23, 2025
@mergify mergify bot added the auto merged label Jan 23, 2025
@mergify mergify bot merged commit 9032907 into spinnaker:master Jan 23, 2025
5 checks passed
@dbyron-sf dbyron-sf deleted the handle-empty-helm-template branch January 23, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Approved and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants